<template>
    <iframe style="width:100%;height:1px;border:none" :style='{"height":height}'></iframe>
</template>
<script>
    import {html} from '../../utils/dom'
    export default{
        name:'CPageIframe',
        props:{
            pData:''
        },
        data(){
            return{
                height:''
            }
        },
        computed:{

        },
        mounted(){
            this.init(this.pData);
        },
        methods:{
          init(info){
              const doc = this.$el.contentDocument;
              const win = this.$el.contentWindow;
              const body = doc.body;
              body.innerHTML = html.decode(info);
              this.$set(this,'height',(body.scrollHeight+50)+'px');
          }
        },
        components:{
        },
        watch:{
            pData(v){
                this.init(v)
            }
        }
    }
</script>